package lookie.app.ui.laf;

import java.util.List;

import javax.annotation.PostConstruct;

import lookie.swing.laf.DefaultLookAndFeelDescriptor;
import lookie.swing.laf.LookAndFeelRegistry;

public class LookAndFeelDescriptorGroup {

	private LookAndFeelRegistry registry;

	private String groupId;

	private List<DefaultLookAndFeelDescriptor> descriptors;

	public void setRegistry(LookAndFeelRegistry registry) {
		this.registry = registry;
	}

	public void setGroupId(String groupId) {
		this.groupId = groupId;
	}

	public void setDescriptors(List<DefaultLookAndFeelDescriptor> descriptors) {
		this.descriptors = descriptors;
	}

	@PostConstruct
	public void afterPropertiesSet() throws Exception {
		for (DefaultLookAndFeelDescriptor descriptor : descriptors) {
			descriptor.setId(groupId + "." + descriptor.getName());
			descriptor.setGroupId(groupId);
			registry.addDescriptor(descriptor);
		}
	}

}
